<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        // 数字三位加一点
        function groupByCommas(n) {
          return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
        }
        console.log(groupByCommas(1234567.008866));    //1,234,567
    </script>
</body>
</html>